﻿using Feicui.BeautyCRM.IDAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Text;
using System.Threading.Tasks;

namespace Feicui.BeautyCRM.Factory
{
    /// <summary>
    /// DbSession实例化抽象工厂
    /// </summary>
    public class DbSessionFactory
    {
        /// <summary>
        /// 获取DbSession的实例
        /// </summary>
        /// <returns></returns>
        public static IDbSession GetCurrentDbSession()
        {
            IDbSession db = CallContext.GetData("DbSession") as DbSession;
            if (db == null)
            {
                db = new DbSession();
                CallContext.SetData("DbSession", db);
            }
            return db;
        }
    }
}
